package net.tksl.crm.controller;

import javax.servlet.http.HttpServletRequest;

import net.tksl.crm.controller.view.bean.UsuarioSistemaBean;
import net.tksl.crm.util.WebUtil;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;

@Controller(value="principalAction")
@Scope(value="prototype")
public class PrincipalAction extends ActionSupport{

	private static final long serialVersionUID = 1L;

	public PrincipalAction(){
	}
	
	public String cargarPanelPrincipal(){
		UsuarioSistemaBean usuarioSistema = (UsuarioSistemaBean)WebUtil.leerAtributoSesion("usuarioSistema");
		if(usuarioSistema!=null){
			HttpServletRequest request = ServletActionContext.getRequest();
			request.setAttribute("tituloPagina","::Panel de Control::");
			return "principal";
		}else{
			return "inicio";
		}
	}

}